package middleware

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"time"
)

/**
跨域处理中间件
 */

func Cors()gin.HandlerFunc{
	return func(c *gin.Context) {
		cors.New(cors.Config{
			AllowOrigins:[]string{"*"},
			AllowMethods:[]string{"*"},
			AllowHeaders:[]string{"Origin"},
			ExposeHeaders:[]string{"Context-Length","Authorization"},
			MaxAge:12*time.Hour,
		})
	}
}
